package com.example.web.controller;

import com.example.web.mapper.ProductMapper;
import com.example.web.model.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * Create by keboom on 2020/7/4
 */
@Controller
public class ShopController {

    @Autowired
    private ProductMapper productMapper;

    /**
     * 商城首页
     * @param model
     * @return
     */
    @GetMapping("/mall/shop")
    public String shop(Model model){
        List<Product> products = productMapper.selectAll();
        model.addAttribute("products",products);
        return "shop";
    }
}
